package com.example.xm.service.impl;

import com.example.xm.entity.DingCai;
import com.example.xm.entity.Fenlei;
import com.example.xm.exception.SerceiceException;
import com.example.xm.mapper.DingcaiMapper;
import com.example.xm.mapper.FenleiMapper;
import com.example.xm.service.IDingcaiService;
import com.example.xm.service.IFenleiService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DingcaiService implements IDingcaiService {
    @Autowired
    DingcaiMapper dingcaiMapper;
    @Override
    public void shoucang(Integer uid, Integer vid) {
        List<DingCai> list= dingcaiMapper.selectList(uid,vid,3,null);
        DingCai dingCai = new DingCai();
        dingCai.setUid(uid);
        dingCai.setVid(vid);
        dingCai.setType(3);
       if(list.size()>0){
           dingcaiMapper.del(dingCai);
       }else{
           dingcaiMapper.add(dingCai);
       }
    }
}
